﻿package mortal.game.view.medal
{
    import com.mui.controls.*;
    import com.mui.utils.*;
    import fl.controls.*;
    import fl.data.*;
    import flash.utils.*;
    import mortal.component.window.*;
    import mortal.game.cache.*;
    import mortal.game.resource.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.view.common.*;
    import mortal.game.view.medal.view.*;
    import mortal.mvc.interfaces.*;

    public class MedalModule extends SpecialWindow
    {
        private var _medalList:GTileList;
        private var _rightPart:MedalRightPart;

        public function MedalModule(param1:ILayer = null)
        {
            this.setSize(780, 591);
            super(param1);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            pushUIToDisposeVec(UIFactory.bg(3, 27, 545, 556, this));
            pushUIToDisposeVec(UIFactory.bg(3, 27, 545, 556, this, ImagesConst.MedalBg));
            this._medalList = UIFactory.tileList(10, 35, 524, 540, this);
            this._medalList.columnWidth = 524;
            this._medalList.rowHeight = 135;
            this._medalList.horizontalGap = -1;
            this._medalList.verticalGap = 0;
            this._medalList.setStyle("cellRenderer", MedalCatagoryRender);
            this._medalList.direction = ScrollBarDirection.VERTICAL;
            this._medalList.isShowVerticalScrollBar = true;
            this._medalList.verticalScrollPolicy = ScrollPolicy.ON;
            this._rightPart = UICompomentPool.getUICompoment(MedalRightPart);
            this._rightPart.x = 552;
            this._rightPart.y = 27;
            this._rightPart.addBg();
            this.addChild(this._rightPart);
            this.titleImageUrl = ImagesConst.medalWinTxt_1;
            this.updateMedal();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._medalList.dispose(param1);
            this._medalList = null;
            this._rightPart.dispose(param1);
            this._rightPart = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function getDataProvider() : DataProvider
        {
            var _loc_2:Object = null;
            var _loc_1:* = new DataProvider();
            var _loc_3:* = MedalConfig.instance.catagoryNum;
            var _loc_4:* = MedalConfig.instance.medcatagoryDic;
            var _loc_5:int = 1;
            while (_loc_5 <= _loc_3)
            {
                
                _loc_2 = {list:_loc_4[_loc_5]};
                _loc_1.addItem(_loc_2);
                _loc_5++;
            }
            return _loc_1;
        }// end function

        public function updateMedal() : void
        {
            this._medalList.dataProvider = this.getDataProvider();
            this._rightPart.updateMedal(Cache.instance.medal.medalDic);
            return;
        }// end function

    }
}
